//
//  canvas.h
//  CBT
//
//  Created by 四点钟 on 2018/11/15.
//  Copyright © 2018 Mr.Zhang. All rights reserved.
//

/**
 *-----通用配色-------*
 **/

/*! 调用根代理方法*/
#define UIAPPLICATION (AppDelegate *)[UIApplication sharedApplication].delegate

//推荐使用 [UIDevice iphoneXSeries]
#define iPhoneX() ([UIScreen instancesRespondToSelector:@selector(currentMode)] ? (floor(([[UIScreen mainScreen] currentMode].size.height/[[UIScreen mainScreen] currentMode].size.width)*100) == 216) : NO)

//#define HFIPhone4 ([UIScreen mainScreen].bounds.size.height == 480)
//#define HFIPhone5 ([UIScreen mainScreen].bounds.size.height == 568)
//HFIphoneX
#define HFIphoneX ([UIScreen instancesRespondToSelector:@selector(currentMode)] ? (floor(([[UIScreen mainScreen] currentMode].size.height/[[UIScreen mainScreen] currentMode].size.width)*100) == 216) : NO)

#define HFIPhoneXSafeAreaPotraitTop 44
#define HFIPhoneXSafeAreaPotraitBottom 34
#define HFIPhoneXSafeAreaPotraitLeft 0
#define HFIPhoneXSafeAreaPotraitRight 0

#define HFIPhoneXSafeAreaLanscapeTop 0
#define HFIPhoneXSafeAreaLanscapeBottom 21
#define HFIPhoneXSafeAreaLanscapeLeft 44
#define HFIPhoneXSafeAreaLanscapeRight 44

//最新状态栏高
#define HFTopStatusHeight [[UIApplication sharedApplication] statusBarFrame].size.height
//最新segMentFrameY
#define HFSegMentFrameY (HFIphoneX ? StartViewHeight : HFNavigationHeight)
//最新导航高
#define HFNavigationHeight (HFTopStatusHeight+44)

//模板页大量了使用该宏，不得修改。
#define HeightRatio(height) (FullScreenWidth> FullScreenHeight ? HSetHeight(height) :SetHeight(height))

#define IPhoneXSafeAreaPotraitTop 44
#define IPhoneXSafeAreaPotraitBottom 34
#define IPhoneXSafeAreaPotraitLeft 0
#define IPhoneXSafeAreaPotraitRight 0

#define IPhoneXSafeAreaLanscapeTop 0
#define IPhoneXSafeAreaLanscapeBottom 21
#define IPhoneXSafeAreaLanscapeLeft 44
#define IPhoneXSafeAreaLanscapeRight 44

#define StartViewHeight (iPhoneX() ? 88 : 64)
//获取设备的物理宽度
#define FullScreenHeight [UIScreen mainScreen].bounds.size.height
#define FullScreenWidth [UIScreen mainScreen].bounds.size.width
#define SafeFullScreenWidth  MIN([[UIScreen mainScreen] bounds].size.width, [[UIScreen mainScreen] bounds].size.height)
#define SafeFullScreenHeight  MAX([[UIScreen mainScreen] bounds].size.width, [[UIScreen mainScreen] bounds].size.height)

static const float HFIPhone6Width  = 375.0;
static const float HFIPhone6Height = 667.0;

//高度
#define SetHeight(height)  ((CGFloat)((height)*1.0 * FullScreenWidth/HFIPhone6Width))
//横屏高度
#define HSetHeight(height)  (height)*1.0 * FullScreenHeight/HFIPhone6Width
//模板页大量了使用该宏，不得修改。
#define HeightRatio(height) (FullScreenWidth> FullScreenHeight ? HSetHeight(height) :SetHeight(height))

#ifndef RGBACOLOR
#define UIColorFromRGBA(rgbValue, a) [UIColor colorWithRed:((float)((rgbValue & 0xFF0000) >> 16))/255.0 green:((float)((rgbValue & 0xFF00) >> 8))/255.0 blue:((float)(rgbValue & 0xFF))/255.0 alpha:a]
#define UIColorFromRGB(rgbValue) UIColorFromRGBA(rgbValue, 1.f)
#endif

//通用横线颜色
#define LineViewBgColor UIColorFromRGB(0xf1f1f1)

//通用紫色文字颜色
#define DefaultPurpleColor UIColorFromRGB(0x9a2ef6)

//通用图片背景默认颜色
#define DefaultImageViewBgColor UIColorFromRGB(0xeeeeee)

//通用蓝色文字颜色
#define DefaultBlueColor UIColorFromRGB(0x556af9)
#define DefaultOrangeColor UIColorFromRGB(0xff5101)

//基于1334*750分辨率
#define AspectScale(measure) ((measure) *(ScreenNarrowSide/375.f))

#define COLOR_32 UIColorFromRGB(0x323232)
#define COLOR_96 UIColorFromRGB(0x969696)
#define COLOR_5B UIColorFromRGB(0xff5b5b)
#define COLOR_C8 UIColorFromRGB(0xc8c8c8)

#define COLOR_SEPARATOR UIColorFromRGB(0xe6e6e6)
#define COLOR_BACKGROUND UIColorFromRGB(0xf0f0f0)

#define IMAGE_PLACEHOLDER_HEAD [UIImage imageNamed:@"image_head"]

#define NSStringstr(string) [NSString stringWithFormat:@"%@",string]
#define NSStringInt(inter) [NSString stringWithFormat:@"%d",(int)inter]
#define NSStringLong(inter) [NSString stringWithFormat:@"%ld",(long)inter]

#define HEFANTV_TOKEN @"token"
#define HEFANTV_DEVICETOKEN [[NSUserDefaults standardUserDefaults] objectForKey:HEFANTV_TOKEN]


#define HEFANTV_Userinfo @"Userinfo"
#define HEFANTV_UserDic [[NSUserDefaults standardUserDefaults]objectForKey:HEFANTV_Userinfo]

#define HEFANTV_PassWord @"passWord"
#define HEFANTV_UserPassWord [[NSUserDefaults standardUserDefaults]objectForKey:HEFANTV_PassWord]

#define HEFANTV_PayPassWord @"payPassword"
#define HEFANTV_UserPayPassWord [[NSUserDefaults standardUserDefaults]objectForKey:HEFANTV_PayPassWord]
